package connection;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public abstract class ConnectionOut implements Runnable{
	private Socket socket;
	protected DataOutputStream dos;
	protected Relay relay;
	
	public ConnectionOut(Socket socket, Relay relay) {
		this.socket = socket;
		this.relay = relay;
	}

	@Override
	public void run() {
		try {
			dos = new DataOutputStream(socket.getOutputStream());
			while (true) {
				handleMessage();
			}
		} 
		catch (IOException e) {
			e.printStackTrace();
		}
		
	}
	
	protected abstract void handleMessage();
}
